package org.zjt.demo.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.zjt.demo.common.JsonResult;
import org.zjt.demo.service.IDisruptorService;

/**
 * Created by zhang on 2017/3/3.
 */
@Api("Disruptor 测试")
@RestController
@RequestMapping("/disruptor")
public class DisruptorController {

    @Autowired
    private IDisruptorService disruptorService;

    @PutMapping("/test")
    @ApiOperation("测试Disruptor执行")
    public JsonResult<String> test(@ApiParam(value = "执行线程数",required = true)@RequestParam(value = "thread_cnt",required = false) Integer threadCnt)throws Exception{
        disruptorService.sendMessage(threadCnt);
        return JsonResult.getSuccessResult(null, JsonResult.SUCCESS_MSG);
    }


}
